package com.itheima.health.service.impl;

import com.itheima.health.common.MessageConst;
import com.itheima.health.dao.MemberDao;
import com.itheima.health.dao.OrderDao;
import com.itheima.health.dao.OrderSettingDao;
import com.itheima.health.dao.SetMealDao;
import com.itheima.health.exception.BusinessRuntimeException;
import com.itheima.health.pojo.Member;
import com.itheima.health.pojo.Order;

import com.itheima.health.pojo.OrderInfo;
import com.itheima.health.pojo.OrderInfo;

import com.itheima.health.pojo.OrderInfo;
import com.itheima.health.service.OrderService;
import com.itheima.health.vo.OrderSubmitParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

import java.util.List;
import java.util.Map;

/**
 * 预约ServiceImpl
 */
@Service
@Slf4j
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderSettingDao orderSettingDao;
    @Autowired
    private OrderDao orderDao;
    @Autowired
    private SetMealDao setMealDao;

    @Override
    public List<Map<String, Object>> countBySetMeal() {
        return setMealDao.findSetmealCount();
    }


    /**
     * 添加预约信息
     * @param order1
     */
    @Override
    public void addOrder(Order order1) {
        //在order表中增加预约信息
        orderDao.addOrder(order1);
    }

    /**
     * 添加会员id绑定会员信息
     * @param id
     */
    @Override
    public void addMemberId(Integer id) {
        orderDao.addMemberId(id);
    }

    /**
     * 根据会员id查询order表单
     * @param id
     * @return
     */
    @Override
    public Order selectMemberId(Integer id) {
        Order order = orderDao.selectMemberId(id);
        return order;
    }


    @Override
    public Order selectById(Integer id) {
        Order order = orderDao.selectById(id);
        return order;
    }

    @Override
    public OrderInfo selectSetmealAndMemberByOrderId(Integer id) {
        OrderInfo orderInfo = orderDao.selectSetmealAndMemberByOrderId(id);
        return orderInfo;
    }


}